package com.itkjb.leisurely.resource.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.itkjb.leisurely.resource.sys.model.SysUserRoleModel;
import com.itkjb.leisurely.resource.sys.model.dto.SysRoleUserDTO;
import com.itkjb.leisurely.resource.sys.model.vo.SysUserRoelVO;
import com.itkjb.leisurely.resource.sys.model.vo.SysUserVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户绑定角色 Mapper 接口
 * </p>
 *
 * @author itkjb.com
 * @since 2020-07-17
 */
public interface SysUserRoleMapper extends BaseMapper<SysUserRoleModel> {
    /**
     * 根据 角色id 获取已绑定的用户
     * @param page 分页条件
     * @param vo 搜索条件
     * @return
     */
    IPage<SysUserVO> getUsersByRoleId(IPage<?> page, @Param("userRoleVO") SysUserRoelVO vo);

    /**
     * 根据 角色id 获取未绑定的用户
     * @param vo 搜索条件
     * @return
     */
    IPage<SysUserVO> getUsersByRoleIdNotBind(IPage<?> page,@Param("userRoleVO") SysUserRoelVO vo);


    /**
     * 查询用户绑定的角色
     * @param model
     * @return
     */
    List<SysUserRoleModel> getRolesByUserId(@Param("userRole") SysUserRoleModel model);

    /**
     * 根据角色编码查询所绑定的用户
     * @param page
     * @param dto
     * @return
     */
    IPage<SysUserVO> getUsersByRoleCode(IPage<?> page, @Param("roleUser")SysRoleUserDTO dto);



}
